import { a as i } from "./cookie.6dbf4ab5.js";
import { a as s } from "./axios.176b0184.js";
import "./__commonjsHelpers__.86354e3f.js";
import "./async-vendor.47a54775.js";
function a({ code: t, VUE_APP_BASE_API: r, token: n }) {
  return s({
    url: r + "/dictionary/getvaluelistbydiscode",
    method: "get",
    headers: {
      Authorization: `Bearer ${n}`
    },
    params: { code: t }
  }).then((e) => e.data);
}
function u(t) {
  try {
    return JSON.parse(t);
  } catch (r) {
    return console.error(r), null;
  }
}
const g = function(t) {
  if (!t)
    return null;
  var r = `dic.${t}`, n = i.get(r);
  return n && sessionStorage.getItem(r) ? Promise.resolve(u(sessionStorage.getItem(r))) : a(t).then((e) => e.data).then((e) => e ? e && e.length <= 0 ? Promise.resolve([]) : (e = e.map((o) => ({
    label: o.name,
    value: o.code + ""
  })), i.set(r, 1, { expires: 0.5 / 24 }), sessionStorage.setItem(r, JSON.stringify(e)), Promise.resolve(e)) : Promise.resolve([]));
};
function v(t = [], r) {
  var n = t.filter((e) => e.value == r);
  if (n && n[0])
    return n[0].label;
}
function p(t = [], r) {
  var n = t.filter((e) => e.value == r);
  if (n && n[0])
    return n[0];
}
export {
  g as ajaxDicList,
  p as getLabelOne,
  v as getLabelText
};
